import Vue from 'vue'
import Router from 'vue-router'

const _import = require('./import_' + process.env.NODE_ENV) // 懒加载 导包

Vue.use(Router)

const constantRouterMap = [
  { path: '/', name: 'main', redirect: '/main/index' },
  {
    path: '/main',
    name: 'home',
    component: _import('home/index'),
    children: [
      { path: 'index', name: 'index', component: _import('home/home') },
      { path: 'me', name: 'me', component: _import('home/me') }
    ]
  },
  { path: '/process/task/todo', name: 'todo', component: _import('process/task/todo/index') },
  { path: '/process/task/apply', name: 'apply', component: _import('home/index') },
  { path: '/process/task/cc', name: 'cc', component: _import('home/index') }
]

let router = new Router({
  scrollBehavior: () => ({y: 0}),
  routes: constantRouterMap
})

router.beforeEach(function (to, from, next) {
  next()
})

router.afterEach(function (to) {
})

export default router
